﻿<%@ Page Title="" Language="C#" MasterPageFile="~/student/Student.Master" AutoEventWireup="true" CodeBehind="viewClass.aspx.cs" Inherits="RC1.student.viewClass" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 115px;
        }
        .style2
        {
            width: 608px;
            margin-left: 40px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h3>Flokkur</h3>
    <table style="width:100%;">
        <tr>
            <td class="style1">
                Lærari</td>
            <td class="style2">
                <asp:Label ID="Label1" runat="server" Text="teacherLabel"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style1">
                Lærugrein</td>
            <td class="style2">
                <asp:Label ID="Label2" runat="server" Text="fakLabel"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style1">
                Lýsing</td>
            <td class="style2">
                <asp:Label ID="Label3" runat="server" Text="descriptionLabel"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style1">
                Næmingar í flokki</td>
            <td class="style2">
                <asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
    </table>
    <br />
    <hr />
    <h3>Uppgávu yvirlit</h3>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="assignment_id" OnRowCommand = "GridviewCommandEventHandler" DataSourceID="SqlDataSource1" 
        EmptyDataText="Tað eru ongar uppgávur" CellPadding="5" 
        Width="100%" AllowSorting="True">
        <Columns>
            <asp:BoundField DataField="assignment_id" HeaderText="assignment_id" 
                ReadOnly="True" SortExpression="assignment_id" Visible="False" />
            <asp:BoundField DataField="class_id" HeaderText="class_id" 
                SortExpression="class_id" Visible="False" />
            <asp:ButtonField CommandName="viewAssignment" DataTextField="assignment_title" 
                HeaderText="Navn" />
            <asp:BoundField DataField="assignment_description" HeaderText="Lýsing" 
                SortExpression="assignment_description" />
            <asp:BoundField DataField="assignment_deadline" 
                HeaderText="Freist" SortExpression="assignment_deadline" />
            <asp:TemplateField HeaderText="Tíð eftir">
                <ItemTemplate>
                    <%# getTimeRemaining((int)Eval("assignment_id")) %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Støða">
                <ItemTemplate>
                    <%# getCorrectedState((int)Eval("assignment_id")) %>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:tsu2011db4ConnectionString1 %>" 
        ProviderName="<%$ ConnectionStrings:tsu2011db4ConnectionString1.ProviderName %>" 
        
        
        SelectCommand="SELECT * FROM [assignment] WHERE ([class_id] = @class_id) ORDER BY [assignment_deadline] DESC">
        <SelectParameters>
            <asp:QueryStringParameter Name="class_id" QueryStringField="id" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
    <br />
</asp:Content>
